package com.yang.crawler.web;

import com.yang.crawler.common.Response;
import com.yang.crawler.dto.data.ThreadPoolMonitorDTO;
import com.yang.crawler.thread.manager.ThreadPoolMonitorManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/monitor")
public class MonitorController {
    @GetMapping(value = "/threadPool")
    public Response<List<ThreadPoolMonitorDTO>> monitorThreadPool() {
        List<ThreadPoolMonitorDTO> threadPoolMonitorDTOList = ThreadPoolMonitorManager.getThreadPoolMonitorResults();
        return Response.success(threadPoolMonitorDTOList);
    }
}

